package com.xmy.cultivate.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xmy.cultivate.entity.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xmy.cultivate.entity.excelEntity.TranscriptScoreExcel;
import com.xmy.cultivate.entity.views.*;
import com.xmy.cultivate.respons.ResTranscriptScore;
import org.apache.ibatis.annotations.Param;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.List;

/**
 * <p>
 * 成绩管理 服务类
 * </p>
 *
 * @author hpiggy
 * @since 2023-04-14
 */
public interface ITranscriptService extends IService<Transcript> {

    public abstract List<StudentTranscript> getEnteringStudent(String[] gradeIdList, Quarter quarter, TranscriptSet transcriptSet);

    /**
     * 成绩数据
     *
     * @return
     */
    public abstract List<ScoreData> scoreData(String schoolId, List<Long> schoolIdList, String subjectsId, String yearPart, String quarterNum, String examNum, String gradeSection, String yearClassId, String type, String include, String courseTypeId, String dataType);


    /**
     * 成绩数据导出
     *
     * @return
     */
    public abstract List<ScoreDataExcel> scoreDataExcel(String schoolId, List<Long> schoolIdList, String subjectsId, String yearPart, String quarterNum, String examNum, String gradeSection, String yearClassId, String type, String include, String courseTypeId, String dataType);

    /**
     * 实际统计情况
     *
     * @return
     */
    public abstract IPage<ScoreDataDetail> scoreDataDetail(IPage<?> page, String schoolId, String subjectsId, String yearPart, String quarterNum, String examNum, String gradeSection, String yearClassId, String type, String teacherId, String gradeId, String isStatistics, String include, String studentName, String courseTypeId, String dataType);

    /**
     * 成绩详情
     *
     * @return
     */
    public abstract IPage<ScoreDataDetail> otherScoreDataDetail(IPage<?> page, String schoolId, String subjectsId, String yearPart, String quarterNum, String examNum, String gradeSection, String yearClassId, String type, String teacherId, String gradeId, String scoreDetailType, String status, String include, String studentName, String courseTypeId, String dataType, String carryStatus);

    public abstract boolean addTrascript(Student student);

    public abstract String verifyScore(Student student);

    void addStudentClassType(Student student, Quarter quarter, ResTranscriptScore transcript, Integer yearClassId);

    public abstract List<ResTranscriptScore> getStudentScore(Integer yearPart, Integer quarterNum, Long studentId, Integer examNum);

    /**
     * @param schoolId             当前在读课时大于零校区
     * @param yearPart             当前在读课时大于零年份
     * @param quarterNum           当前在读课时大于零季度
     * @param yearPartTranscript   当前录入分数的年份
     * @param quarterNumTranscript 当前录入分数的学期
     * @param examNum              考试名称id:1期中，2期中摸底，3期末，4期末摸底，5市模拟
     * @return
     */
    public abstract List<TranscriptScoreExcel> getTranscriptList(Long schoolId, Integer yearPart, Integer quarterNum, Integer yearPartTranscript, Integer quarterNumTranscript, Integer examNum);

    public abstract Transcript getOneForQuarter(Integer yearPart, Integer quarterNum, Long subjectsId, Long studentId, Integer examNum);

    /**
     * 获取在读学员成绩信息
     *
     * @param yearPart        学员所在班级的年份
     * @param quarterNum      学员所在班级的学期
     * @param yearPartWrite   家长填写成绩的年份
     * @param quarterNumWrite 家长填写成功的学期
     * @param examNum         考试名称id
     * @param isStatistics    0为未填写，1为已填写
     * @return
     */
    List<ScoreData> getReadStudent(Integer yearPart, Integer quarterNum, Integer yearPartWrite, Integer quarterNumWrite, Integer examNum, String isStatistics, List<Integer> yearClassIdList);

    @Async("onlineAsync")
    void writeTranscriptPush(Integer yearPart, Integer quarterNum, Integer examNum, String isStatistics, Quarter quarter, List<Integer> yearClassIdList, Integer weicharPushCount, TranscriptSet transcriptSet) throws InterruptedException;

    /**
     * 人员分析安全值
     *
     * @param schoolId
     * @param subjectsId
     * @param yearPart
     * @param quarterNum
     * @return
     */
    public abstract List<HashMap<String, Object>> securityData(String schoolId, String subjectsId, String yearPart, String quarterNum, String teacherStr, String gradeSection);

    /**
     * 批量移出和移入
     *
     * @param isEliminate
     * @param studentId
     * @return
     */
    public abstract Integer updateIsEliminate(String isEliminate, String studentId, String quarterNum, String yearPart, String schoolId);

    /**
     * 根据年级批量移出和移入
     *
     * @param isEliminate
     * @param yearClassId
     * @return
     */
    public abstract Integer updateIsEliminateByYearClassId(String isEliminate, String yearClassId, String quarterNum, String yearPart);


    IPage<ResNewStuScore> newStudentScore(IPage<?> page, String schoolId, String subjectsId, String yearClassId, String startDate, String endDate, String scoreYearPart, String scoreQuarterNum, String studentName);

    Transcript getDataTranscript(Integer yearPart, Integer quarterNum, Long studentId, Long subjectsId, Integer examNum);

    Long getApplyTranscriptIsIn(Integer yearPart, Integer quarterNum, Long subjectsId, Long studentId, Integer yearClassId, Integer examNum);
}
